package com.yjhb.android.sbz.mvp.violation;

import com.yjhb.android.sbz.entity.ResultSet;
import com.yjhb.android.sbz.entity.Violation;
import com.yjhb.android.sbz.http.HttpObserver;
import com.yjhb.android.sbz.http.HttpTool;
import com.yjhb.android.sbz.mvp.ConventionPresenter;

/**
 * 创建者 zx
 * 创建时间 2021/1/11 10:28
 */
public class ViolationPublicityPresenter extends ConventionPresenter<ViolationPublicityView> {
    private final String TAG = "ViolationPublicityPresenter";

    @Override
    protected void onDestroy() {

    }

    public ViolationPublicityPresenter(ViolationPublicityView violationPublicityView) {
        super(violationPublicityView);
    }

    public void getViolateInfo(int size, int current) {
        HttpTool.request(model.getViolateInfo(size, current), new HttpObserver<ResultSet<Violation>>() {
            @Override
            public void onResult(ResultSet<Violation> data) {
                if (view != null) {
                    view.onData(data.getRecords(), current == 1);
                }
            }

            @Override
            public void onError(int code, String msg) {
                if (view != null) {
                    view.onFailure(code, msg);
                }
            }
        });

    }

}
